var express = require('express');
var router = express.Router();
var messageModel = require('../tool/model/message.js');
router.post('/', (req, res, next)=> {
  let ctime = Date.now()
  var obj = req.body;
  console.log(obj)
  var message = new messageModel ({
    messageMark:obj.userId,
    ctime:ctime,
    messagePhone:obj.Phone,
    messageContent:obj.content,
    messageName:obj.userName,
    messageEmail:obj.Email
  })
  message.save(function(err,doc){
          if(err){
              console.log(err);
              return;
          }else{
            res.send({
              status: '0',
              type:'success',
              content: '感谢您的留言,如果有必要博主会及时回复！',
              data:doc
            })
          }
      })
});
module.exports = router;